//
//  MLWTipsICookKnowledgeCell.m
//  KITCHEN_STORIES
//
//  Created by 孟令通 on 16/6/14.
//  Copyright © 2016年 MLW. All rights reserved.
//

#import "MLWTipsICookKnowledgeCell.h"

#import "MLWTipsICookKnoledgeModel.h"

#import "MLWBaseView.h"

@implementation MLWTipsICookKnowledgeCell

-(id)initWithIdentifier:(NSString *)identifier
{
    self = [super initWithIdentifier:identifier];
    
    if (self) {
        
        self.knowledgeArray = [NSArray array];
        self.identifier = identifier;
    }
    
    return self;
}

-(void)setKnowledgeArray:(NSArray *)knowledgeArray
{
    
    if (_knowledgeArray != knowledgeArray) {
        
        [_knowledgeArray release];
        
        _knowledgeArray = [knowledgeArray retain];
        
        MLWTipsICookKnoledgeModel *model = [_knowledgeArray firstObject];
        
        UIImageView *knowledgeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 300)];
        
        [knowledgeImageView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:[UIImage imageNamed:@"placeholder"]];
        
        [self addSubview:knowledgeImageView];
        [knowledgeImageView release];
        
        UILabel *nutritionAnalysis = [[UILabel alloc] initWithFrame:CGRectMake(15, 305, ScreenWidth - 30, 40)];
        
        nutritionAnalysis.text = model.nutrition_analysis;
        [nutritionAnalysis setFont:[UIFont systemFontOfSize:14]];
        nutritionAnalysis.numberOfLines = 0;
        
        [self addSubview:nutritionAnalysis];
        [nutritionAnalysis release];
        
        UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(15, 350, ScreenWidth - 30, 40)];
        
        description.text = model.production_direction;
        [description setFont:[UIFont systemFontOfSize:14]];
        description.numberOfLines = 0;
        
        [self addSubview:description];
        [description release];
        
        
    }
    
}

@end
